<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Show Computer_status</title>
    {% load staticfiles %}
    <link rel="stylesheet" type="text/css" href={% static "/css/base.css" %}>
    <link rel="stylesheet" type="text/css" href={% static "/css/changelists.css" %}>
    <link rel="stylesheet" type="text/css" href={% static "/css/responsive.css" %}>
    <script src="{% static '/jquery-1.8.3.min.js' %}"></script>

    <script>
        function _srot(obj) {
            var name = $(obj).text();
            var ziduan;
            switch (name) {
                case ("IP地址"):
                    ziduan = "c_network";
                    break;
                case ("系统类型"):
                    ziduan = "system_type";
                    break;
                case ("登录用户"):
                    ziduan = "name";
                    break;
                case ("资产使用者"):
                    ziduan = "asset_users";
                    break;
                case ("座位编号"):
                    ziduan = "seat_number";
                    break;
                case ("IT资产编号"):
                    ziduan = "it_number";
                    break;
                case ("CPU"):
                    ziduan = "c_cpu";
                    break;
                case ("内存"):
                    ziduan = "c_memory";
                    break;
                case ("显卡"):
                    ziduan = "c_display";
                    break;
                case ("MAC地址"):
                    ziduan = "mac_network";
                    break;
                case ("最后更新时间"):
                    ziduan = "c_time";
                    break;
            }
            $.post("/event_manage/", {'ziduan':ziduan}, function (data, status) {
                $("#in_tab").html(data);
            });
        }
    </script>
</head>
<body>

        <table id="in_tab">
            <div id="navbar">
                <li> <a href="#">计算机信息展示</a> </li>
                <li> <a href="/Statistical_computer/">计算机资产统计</a> </li>
            </div>
        <div>
            <form method="get" action="/search_name/">
                <div>
                    <select name="index_computer">
                        <option value="c_network">IP地址</option>
                        <option value="c_cpu">CPU</option>
                        <option value="c_memory">内存</option>
                        <option value="mac_network">MAC地址</option>
                        <option value="c_display">显卡</option>
                        <option value="name">登录名称</option>
                        <option value="computer_name">计算机名</option>
                        <option value="system_type">系统类型</option>
                        <option value="asset_users">资产使用者</option>
                        <option value="it_number">IT资产编号</option>
                        <option value="seat_number">座位编号</option>
                        <option value="c_time">更新时间</option>
                    </select>
                    <input name="index_name" type="text" placeholder="名称">
                    <button type="submit">搜索</button>
                </div>
            </form>
        </div>
        <p></p>
            <div>
                <thead>
                    <tr>
                        <th id="t1" onclick="_srot(this)">IP地址</th><th id="t2" onclick="_srot(this)">系统类型</th><th id="t3" onclick="_srot(this)">登录用户</th><th id="t4" onclick="_srot(this)">资产使用者</th><th id="t5" onclick="_srot(this)">座位编号</th><th id="t6" onclick="_srot(this)">IT资产编号</th><th id="t7" onclick="_srot(this)">CPU</th><th id="t8" onclick="_srot(this)">内存</th><th id="t9" onclick="_srot(this)">显卡</th><th id="t10" onclick="_srot(this)">MAC地址</th><th id="t11" onclick="_srot(this)">最后更新时间</th>
                    </tr>
                </thead>
            </div>
            <div>
                {% for computer_status in computer_statuses %}
                    {% if  forloop.counter|get_quyu  %}
                        <tr class="row1">
                            <td>{{ computer_status.c_network }}</td>
                            <td>{{ computer_status.system_type }}</td>
                            <td>{{ computer_status.name }}</td>
                            <td>{{ computer_status.asset_users }}</td>
                            <td>{{ computer_status.seat_number }}</td>
                            <td>{{ computer_status.it_number }}</td>
                            <td>{{ computer_status.c_cpu }}</td>
                            <td>{{ computer_status.c_memory}}</td>
                            <td>{{ computer_status.c_display}}</td>
                            <td>{{ computer_status.mac_network}}</td>
                            <td>{{ computer_status.c_time }}</td>
                        </tr>
                    {% else %}
                        <tr class="row2">
                            <td>{{ computer_status.c_network }}</td>
                            <td>{{ computer_status.system_type }}</td>
                            <td>{{ computer_status.name }}</td>
                            <td>{{ computer_status.seat_number }}</td>
                            <td>{{ computer_status.it_number }}</td>
                            <td>{{ computer_status.it_number }}</td>
                            <td>{{ computer_status.c_cpu }}</td>
                            <td>{{ computer_status.c_memory}}</td>
                            <td>{{ computer_status.c_display}}</td>
                            <td>{{ computer_status.mac_network}}</td>
                            <td>{{ computer_status.c_time }}</td>
                        </tr>
                    {% endif %}
                {% endfor %}
            </div>
        </table>
        <p>{{ number }}条数据</p>
</body>
</html>